package com.example.leetdemo.finash;

public class Solution507 {
    public boolean checkPerfectNumber(int num) {
        int count = 0;
        int p = num, q = num / 2;
        while (q > 0) {
            if (p % q == 0) {
                count += q;
            }
            q--;
        }
        if (count == num) {
            return true;
        }
        return false;
    }

    public static void main(String[] args) {
        Solution507 solution507 = new Solution507();
        System.err.println(solution507.checkPerfectNumber(8128));
    }
}
